//
//  ViewController.m
//  mainpage
//
//  Created by John Zheng on 2018/5/9.
//  Copyright © 2018年 John Zheng. All rights reserved.
//

#import "ViewController.h"
#import"first.h"

@interface ViewController ()
@property(nonatomic,strong) UINavigationController *navi;
@end

@implementation ViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO];
}

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self.navigationController setNavigationBarHidden:YES];
//    [self.navigationController setToolbarHidden:NO animated:YES];
//    [self.navigationController.toolbar setBarStyle:UIBarStyleDefault];
//    self.navigationController.toolbar.frame=CGRectMake(0, [UIScreen mainScreen].bounds.size.height-50, [UIScreen mainScreen].bounds.size.width, 50);
////    [self.navigationController setToolbarHidden:NO animated:YES];
////    [self.navigationController.toolbar setBarStyle:UIBarStyleDefault];
////    self.navigationController.toolbar.frame=CGRectMake(0, [UIScreen mainScreen].bounds.size.height-44, [UIScreen mainScreen].bounds.size.width, 44);
//////
//        UIBarButtonItem *btn7=[[UIBarButtonItem alloc]initWithTitle:@"gttybt1" style:UIBarButtonItemStyleDone target:self action:@selector(haha:)];
//    //[btn7 setTitle:@"1"];
//    NSArray *btnAry=[[NSArray alloc]initWithObjects:btn7, nil];
//    self.toolbarItems=btnAry;



//
//    UIBarButtonItem *customItem1 = [[UIBarButtonItem alloc]initWithTitle:@"预览" style:UIBarButtonItemStyleDone target:self action:@selector(toolBarItem1:)];
//
//    UIBarButtonItem *customItem2 = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(toolBarItem2:)];
//
//    UIBarButtonItem *haha = [[UIBarButtonItem alloc]initWithTitle:@"hahah" style:UIBarButtonItemStyleDone target:self action:@selector(hahah)];
//
//    UIBarButtonItem *heihei = [[UIBarButtonItem alloc]initWithTitle:@"heihei" style:UIBarButtonItemStyleDone target:self action:@selector(hahah)];
//
//    UIBarButtonItem *yeye = [[UIBarButtonItem alloc]initWithTitle:@"yeye" style:UIBarButtonItemStyleDone target:self action:@selector(hahah)];
//
//    UIBarButtonItem *yaya = [[UIBarButtonItem alloc]initWithTitle:@"yayayayayya" style:UIBarButtonItemStyleDone target:self action:@selector(hahah)];
//
//    UIBarButtonItem *lala = [[UIBarButtonItem alloc]initWithTitle:@"lala" style:UIBarButtonItemStyleDone target:self action:@selector(hahah)];
//
//    NSArray *arr1 = [[NSArray alloc]initWithObjects:customItem1,customItem2,haha,lala,heihei,yaya,yeye, nil];
//
//    self.toolbarItems = arr1;
    self.view.backgroundColor = [UIColor whiteColor];
    
    //控制图片位置
    typedef struct UIEdgeInsets {
        CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values can be negative to 'outset'
    } UIEdgeInsets;
    
    //标签1
    UILabel* lab1 = [[UILabel alloc]init];
    lab1.text = @"USRername";
    lab1.frame = CGRectMake(110, 110, 200, 45);
    lab1.backgroundColor = [UIColor whiteColor];
    lab1.font = [UIFont systemFontOfSize:24];
    [self.view addSubview:lab1];
    
    
    //头像btn
    btn_1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn_1.frame = CGRectMake(20, 70, 80, 80);
    btn_1.backgroundColor = [UIColor whiteColor];
    btn_1.layer.masksToBounds = YES;
    btn_1.layer.borderWidth = 2;
    btn_1.layer.borderColor = [UIColor blackColor].CGColor;
    btn_1.layer.cornerRadius = 40;
    [btn_1 addTarget:self action:@selector(clickBtn_1) forControlEvents:UIControlEventTouchUpInside];
    [btn_1 setBackgroundImage:[UIImage imageNamed:@"头像.jpg"]  forState:UIControlStateNormal];
    //第一位按钮
    btn1 =[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.frame = CGRectMake(32, 190, 170, 100);
    btn1.backgroundColor =[UIColor whiteColor];
    btn1.layer.masksToBounds =YES;
//    btn1.layer.borderWidth = 5.0;
//    btn1.layer.borderColor = [UIColor whiteColor].CGColor;
    btn1.layer.cornerRadius = 15;
   
    [btn1 setBackgroundImage:[UIImage imageNamed:@"定位.png"] forState:UIControlStateNormal];
    [btn1 setTitle:@"定位" forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
//    [btn1 setImageEdgeInsets:UIEdgeInsetsMake(0, 20, 0, 0)];
    btn1.imageEdgeInsets = UIEdgeInsetsMake(0, btn1.titleLabel.bounds.size.width, 0, -btn1.titleLabel.bounds.size.width);
    
    
    //第二位按钮
    btn2 =[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn2.frame = CGRectMake(215, 190, 170, 100);
    btn2.backgroundColor =[UIColor whiteColor];
    btn2.layer.masksToBounds =YES;
//    btn2.layer.borderWidth = 5.0;
//    btn2.layer.borderColor = [UIColor lightGrayColor].CGColor;
    btn2.layer.cornerRadius = 15;
    [btn2 setTitle:@"导航" forState:UIControlStateNormal];
     [btn2 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn2 setBackgroundImage:[UIImage imageNamed:@"导航.png"] forState:UIControlStateNormal];
    
    //第三位按钮
    btn3=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn3.frame = CGRectMake(32, 300, 170, 100);
    btn3.backgroundColor =[UIColor whiteColor];
    btn3.layer.masksToBounds =YES;
//    btn3.layer.borderWidth = 5.0;
//    btn3.layer.borderColor = [UIColor lightGrayColor].CGColor;
    btn3.layer.cornerRadius = 15;
    [btn3 setTitle:@"电台" forState:UIControlStateNormal];
     [btn3 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn3 setBackgroundImage:[UIImage imageNamed:@"电台.png"] forState:UIControlStateNormal];
    
    //第四位按钮
    btn4 =[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn4.frame = CGRectMake(215, 300, 170, 100);
    btn4.backgroundColor =[UIColor whiteColor];
    btn4.layer.masksToBounds =YES;
//    btn4.layer.borderWidth = 5.0;
//    btn4.layer.borderColor = [UIColor lightGrayColor].CGColor;
    btn4.layer.cornerRadius = 15;
    [btn4 setTitle:@"动态" forState:UIControlStateNormal];
     [btn4 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn4 setBackgroundImage:[UIImage imageNamed:@"动态.png"] forState:UIControlStateNormal];
    
    //第五位
    btn5=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn5.frame = CGRectMake(32, 410, 170, 100);
    btn5.backgroundColor =[UIColor whiteColor];
    btn5.layer.masksToBounds =YES;
//    btn5.layer.borderWidth = 5.0;
//    btn5.layer.borderColor = [UIColor lightGrayColor].CGColor;
    btn5.layer.cornerRadius = 15;
    [btn5 setTitle:@"测试" forState:UIControlStateNormal];
     [btn5 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn5 setBackgroundImage:[UIImage imageNamed:@"测试.png"] forState:UIControlStateNormal];
    
    //第六位
    btn6=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn6.frame = CGRectMake(215, 410, 170, 100);
    btn6.backgroundColor =[UIColor whiteColor];
    btn6.layer.masksToBounds =YES;
//    btn6.layer.borderWidth = 5.0;
//    btn6.layer.borderColor = [UIColor lightGrayColor].CGColor;
    btn6.layer.cornerRadius = 15;
    [btn6 setTitle:@"其他" forState:UIControlStateNormal];
     [btn6 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn6 setBackgroundImage:[UIImage imageNamed:@"其他.png"] forState:UIControlStateNormal];
    
    //求救btn
    btn_2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn_2.frame = CGRectMake(123, 530, 150, 140);
    btn_2.backgroundColor = [UIColor whiteColor];
    btn_2.layer.masksToBounds = YES;
    btn_2.layer.borderWidth = 2.0;
    btn_2.layer.borderColor = [UIColor blackColor].CGColor;
    btn_2.layer.cornerRadius = 40;
    [btn_2 addTarget:self action:@selector(clickBtn_1) forControlEvents:UIControlEventTouchUpInside];
     [btn_2 setTitle:@"呼救" forState:UIControlStateNormal];
    [btn_2 setTitleColor:[UIColor clearColor]forState:UIControlStateNormal];
    [btn_2 setBackgroundImage:[UIImage imageNamed:@"呼救.png"] forState:UIControlStateNormal];
    
    
    
    [self.view addSubview:btn_1];
    [self.view addSubview:btn1];
    [self.view addSubview:btn3];
    [self.view addSubview:btn2];
    [self.view addSubview:btn4];
    [self.view addSubview:btn6];
    [self.view addSubview:btn5];
    [self.view addSubview:btn_2];
    
}

- (void)clickBtn_1
{
    first *new = [[first alloc]init];
    [self.navigationController pushViewController:new animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
